package com.jingxin.zero.flow.wrapper;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.extra.spring.SpringUtil;
import com.jingxin.zero.sys.feign.ISysUserClient;
import com.jingxin.zero.core.BaseEntityWrapper;
import com.jingxin.zero.sys.entity.SysUser;
import com.jingxin.zero.flow.entity.{{{=it.tableInfo.nameLargeHump}}};
import com.jingxin.zero.flow.vo.{{{=it.tableInfo.nameLargeHump}}}Vo;
import java.util.Objects;


/**
 * @author ethan
 */
public class {{{=it.tableInfo.nameLargeHump}}}Wrapper extends BaseEntityWrapper<{{{=it.tableInfo.nameLargeHump}}}, {{{=it.tableInfo.nameLargeHump}}}Vo>  {

    private ISysUserClient sysUserClient;

    private {{{=it.tableInfo.nameLargeHump}}}Wrapper() {
        sysUserClient = SpringUtil.getBean(ISysUserClient.class);
    }

	public static {{{=it.tableInfo.nameLargeHump}}}Wrapper build() {
		return new {{{=it.tableInfo.nameLargeHump}}}Wrapper();
	}


	@Override
	public {{{=it.tableInfo.nameLargeHump}}}Vo entityVO({{{=it.tableInfo.nameLargeHump}}} {{{=it.tableInfo.nameSmallHump}}}) {
		{{{=it.tableInfo.nameLargeHump}}}Vo {{{=it.tableInfo.nameSmallHump}}}Vo = Objects.requireNonNull(BeanUtil.toBean({{{=it.tableInfo.nameSmallHump}}}, {{{=it.tableInfo.nameLargeHump}}}Vo.class));

        SysUser createUser = sysUserClient.getById({{{=it.tableInfo.nameSmallHump}}}.getCreateUser());
        if(createUser != null){
            {{{=it.tableInfo.nameSmallHump}}}Vo.setCreateUserName(createUser.getName());
        }
        SysUser updateUser = sysUserClient.getById({{{=it.tableInfo.nameSmallHump}}}.getUpdateUser());
        if(updateUser != null){
            {{{=it.tableInfo.nameSmallHump}}}Vo.setUpdateUserName(updateUser.getName());
        }
		return {{{=it.tableInfo.nameSmallHump}}}Vo;
	}

}